1. Field of the Invention
The present invention relates to a communications technique for a Controller Area Network (CAN) system.
2. Description of Related Art
Recent vehicles are equipped with a wide variety of electronic control systems which are used to control an engine's ignition timing, used for a gear box, used for an Anti-Block System (ABS), and so on. With increases in the number of vehicle-mounted systems, there arise problems such as increases in the number of wires and the need for sensor redundancy. Besides, if higher performance is pursued, it becomes necessary to control the systems integrally or in a cooperative manner.
To control systems integrally or in a cooperative manner, it is necessary to conduct data communications among the systems. CAN specified by ISO 11898-1 (“Road vehicles—Interchange of digital information Part 1: Controller area network data link layer and medium access control”) is a communications protocol developed for this purpose. The protocol is used in a wide range of fields including not only vehicles, but also shipping and medical equipment. Now, the CAN protocol will be described briefly.
FIG. 9 is a schematic diagram showing an example of connections in a CAN system. As shown in FIG. 9, the CAN system 10 includes multiple CAN nodes (hereinafter simply referred to as nodes) 12 interconnected via a CAN bus 14. The CAN bus 14 is made up of two wires (wire 16 and wire 18), and a CAN controller (not shown) in each node determines a level of the CAN bus 14 based on a potential difference between the two wires of the CAN bus 14. A transmitting node 12 can transmit a message to another node 12 by changing this level.
When the CAN bus 14 is not busy, all the nodes 12 connected to the CAN bus 14, excluding nodes in Bus Off state (described later), can initiates transmission of a message, but the first node that initiates transmission to the CAN bus 14 gains the right to transmit. If multiple nodes initiate transmission simultaneously, a node which transmits a message with the highest priority gains the right to transmit. Now, priorities will be described together with a frame structure defined by the CAN protocol.
The CAN protocol defines five types of frame: data frame, remote frame, error frame, overload frame, and interframe space. The data frame is used by the transmitting node (sender node) to transmit a message to a receiving node (receiver node). The remote frame is used to request a message with the same priority from the sender node. The error frame is used to notify the other node of any detected error. The overload frame is used by the receiver node to notify of a not-ready-to-receive state. The interframe space is used to separate the data frame and remote frame from the previous frame. Now, format of the data frame will be described as an example.
FIG. 10 shows standard format of the data frame defined by the CAN protocol. As shown in FIG. 10, the CAN's data frame includes multiple fields. SOF and EOF are fields which indicate start and end of the frame, respectively. Arbitration Field represents the priority of the frame and stores an ID code which indicates the priority. If multiple nodes initiate transmission simultaneously, arbitration is conducted based on the IDs of transmitted data frames. As a result of the arbitration, the node which transmits the data frame whose ID has the highest priority proceeds with the transmission, and the other nodes immediately stop transmission and go into a receive operation. Control Field (DLC) represents the numbers of reserved bits and data bytes, and Data Field contains content of the message. CRC Field is used to check for a frame transmit error and ACK Field is used to acknowledge a successful transmission.
Each node 12 is equipped with a transmit error counter and a receive error counter used to count transmit errors and receive errors, respectively. For information about count-up timing and countdown timing of the transmit error counter and the receive error counter as well as about their numbers of counts, it is advised to refer to standards of the CAN protocol. Generally, however, the transmit error counter is incremented when a transmit error is detected, and is decremented when transmission is successful. Similarly, the receive error counter is incremented when a receive error is detected, and is decremented when reception is successful.
Each node changes its state among three error states—Error Active state, Error Passive state, and Bus Off state—according to the counter value (REC) of the receive error counter and counter value (TEC) of the transmit error counter. In Error Active state, the node is ready to participate successfully in communications on the bus. In Error Passive state, the node is more error-prone than in Error Active state. For nodes in Error Passive state, restrictions are placed on continuous transmission and error notification, unlike nodes in Error Active state. The Bus Off state is more error-prone than the Error Passive state. Thus, nodes in Bus Off state are prohibited from performing all transmit and receive operations and are not allowed to participate in communications on the bus.
The changes among the three error states are made based on the counter values of the transmit error counter and receive error counter. As shown in FIG. 11, when the counter value (TEC) of the transmit error counter and counter value (REC) of the receive error counter are both 0 to 127, the node is in Error Active state. When one of TEC and REC is 128 to 255, the node is in Error Passive state. On the other hand, regardless of REC, when TEC is 256 or above, the node is put into Bus Off state and consequently cut off from communications on the CAN bus.
In this way, CAN defines error states according to error proneness, places restrictions on the transmit/receive operations of the node according to the error state, and thereby prevents communications from being obstructed by error-prone nodes.
The CAN protocol provides an automatic message retransmission function to ensure that messages will reach their destination nodes and to reduce undelivered messages. Automatic message retransmission is triggered by a loss in priority arbitration or detection of a transmit error during transmission. Incidentally, detection of transmit errors includes detection made possible by an error notification issued when the destination node fails to receive the message successfully.